package com.blog.backend.gateWayController;


import com.blog.backend.req.ArticleListReq;
import com.blog.backend.resp.ArticleResp;
import com.blog.backend.service.ArticlesService;
import com.blog.backend.utils.Result;
import com.blog.backend.vo.PageResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/technology")
public class DoorTechnologyController {

    @Resource
    private ArticlesService articlesService;


    @PostMapping("/getTechnologyList")
    @ApiOperation("门户查询技术文档列表")
    public Result<PageResult<ArticleResp>> getTechnologyList(@RequestBody ArticleListReq req){
        req.setStatus(2);
        PageResult<ArticleResp> result=  articlesService.getTechnologyList(req);
        return Result.success(result);
    }

    @GetMapping("/getTechnologyDetail")
    public Result<ArticleResp> getTechnologyDetail(@RequestParam String technologyId){
        ArticleResp articleResp = articlesService.queryDetail(technologyId,2);
        return Result.success(articleResp);
    }

    @GetMapping("/getNextArticle")
    public Result<ArticleResp> getNextArticle(@RequestParam String technologyId){
        ArticleResp resp= articlesService.getNextArticle(technologyId);
        return Result.success(resp);
    }

    @GetMapping("/recommendArticleList")
    public Result<List<ArticleResp>> recommendArticleList(){
        List<ArticleResp> list = articlesService.recommendArticleList();
        return Result.success(list);
    }


}
